package com.spring.boot.springBoot.sendEmail;

import com.spring.boot.springBoot.utils.commonly.WebApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by pactera on 2018/1/9.
 */
@RestController
public class SendEmailController {

    @Autowired
    private EmailService emailService;


    @GetMapping("/sendEmail/{email}")
    public WebApiResponse<Map> sendEmail(@PathVariable("email") String email){
        if(!StringUtils.isEmpty(email)){
            try {
                emailService.sendEmail(email+".com","主题","测试文档");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return new WebApiResponse<>();
    }

}
